Hi Scott,
You can't have a KFLOP Axis configured to be part of the Coordinated Motion System (C Axis) and as a Spindle at the same time as there will be a conflict (one may tell the axis to move and the other may tell the axis to stop).
But you should be able to use a custom M Code to include/exclude the KFLOP Axis from the Coodinated Motion System.
Note also to define the B or C axis you must use the DefineCoordSystem6 function to define all 6 axes.
To include as C Axis do:
DefineCoordSystem6(0,-1,1,-1,-1,2);
To exclude and operate as a Spindle do:
DefineCoordSystem6(0,-1,1,-1,-1,-1);
HTH Regards TK
Group: DynoMotion |
Message: 11648 |
From: cnc_machines |
Date: 6/5/2015 |
Subject: Re: Lathe Setup |
Excellent! That makes sense. Maybe I can do something like this: - M03 to exclude the spindle (DefineCoordSystem6(0,-1,1,-1,-1,-1);)
- Spindle - "S" to jog the axis at the speed passed in by S (Jog(2,Speed))
- M05 would stop jogging and re include the axis to coordinated motion (Jog(2,0))(DefineCoordSystem6(0,-1,1,-1,-1,2);)
Does this seem reasonable? Maybe the push buttons in KMotionCNC wouldn't work to start and stop the spindle, but that should be okay (On CW, On CCW and Off).
Thanks,
Scott
|
|
Group: DynoMotion |
Message: 11654 |
From: Tom Kerekes |
Date: 6/6/2015 |
Subject: Re: Lathe Setup |
Hi Scott,
I'm not sure it would work well having the same MCodes M3/M5 switch modes. It isn't clear to me you should switch modes every time the Spindle is turned on and off. You might start off with separate MCodes such as M100, M101 to switch modes and prove everything works. Then see if you can simplify by combining them.
Regards TK
Group: DynoMotion |
Message: 11657 |
From: Tapio Larikka |
Date: 6/7/2015 |
Subject: Re: Lathe Setup |
Hi Steve!
I don't know how this would work under KMotionCNC,
but this works for me under Mach3
-Init file includes the spindle axis to coordinate
system on startup
-M3/M4 excludes/detaches the axis and starts jog at
commanded speed
-M5 stops jog and re-includes/attaches the axis
back to coordinate system
Mach specific parts propably need some
modding.
Use the below example at your own risk and with
caution.
Rgds,
Tapio
#define SPINDLE_AXIS 3 // axis set up as
Spindle, possibly Step/Dir or Servo #define FACTOR 240000 // Converts
fractional pulley speed to counts/sec (may be negative)
main() { int message =
persist.UserData[0]; // Mach3 message ID int Direction =
persist.UserData[1]; // Mach3 Spindle Direction float speed =
*(float *)&persist.UserData[2]; // value stored is actually a
float int *On = &persist.UserData[3]; // value stored is
actually a float int DirFactor = 0; //if
(Direction==0) DirFactor=-1; // change Direcion 0 or 1 to DirFactor -1 or
+1 if
(Direction==0) { DirFactor=1; } else
if
(Direction==1) { DirFactor=-1; }
switch (message) { case
EX_SPINSPEED:
DefineCoordSystem6(0,1,2,-1,-1,-1); speed = *(float
*)&persist.UserData[2]; // value stored is actually a
float printf("Mach3 Notify Message=%d, Direction=%2d,
Spindle Set to %f, Run=%3d\n",message,Direction,speed,*On);
Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor); while
(!CheckDone(SPINDLE_AXIS)); break;
case EX_SPINON: *On =
TRUE;
DefineCoordSystem6(0,1,2,-1,-1,-1); printf("Mach3
Notify Message=%d, Direction=%2d, Spindle Set to %f,
Run=%3d\n",message,Direction,speed,*On);
Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor); while
(!CheckDone(SPINDLE_AXIS)); break;
case EX_SPINOFF: *On =
FALSE; printf("Mach3 Notify Message=%d, Direction=%2d,
Spindle Set to %f, Run=%3d\n",message,Direction,speed,*On);
Jog(SPINDLE_AXIS,0.0); while(!CheckDone(SPINDLE_AXIS));
DefineCoordSystem6(0,1,2,3,-1,-1); break; } //Jog(SPINDLE_AXIS,speed*FACTOR*DirFactor); //while(!CheckDone(SPINDLE_AXIS));
}
----- Original Message -----
Sent: Sunday, June 07, 2015 12:49
AM
Subject: Re: [DynoMotion] Lathe
Setup
Hi Scott,
I'm not sure it would work well having the same MCodes M3/M5
switch modes. It isn't clear to me you should switch modes every time
the Spindle is turned on and off. You might start off with separate
MCodes such as M100, M101 to switch modes and prove everything works.
Then see if you can simplify by combining them.
Regards
TK
Group: DynoMotion |
Message: 11660 |
From: Tom Kerekes |
Date: 6/7/2015 |
Subject: Re: Lathe Setup |
Hi Tapio,
Thanks for sharing we really appreciate it.
But I see one issue. (It might have been from one of our examples). A continuous Jog at some speed will never indicate "Done". For a Jog the "Done" condition will only go true when a Jog Speed of zero (stop) is commanded and then after completely stopped.
So the:
while
(!CheckDone(SPINDLE_AXIS));
should probably be removed from the
case
EX_SPINSPEED:
and
case EX_SPINON:
It may work ok because the program will simply never complete and be killed by the next Spindle command.
Regards TK
Group: DynoMotion |
Message: 11661 |
From: Tapio Larikka |
Date: 6/7/2015 |
Subject: Re: Lathe Setup |
Hi Tom,
I think you are right with them checkdones being
unnecessary. I just haven't removed them as I haven't found them
disturbing.
If I remember right (its over two years since i
wrote that) I added them for some reason that had to do with mach starting
with
EX_Spin On as first message after startup. I have a
vague memory that after startup setting the spindle speed to a
speed DRO started spindle unless the spindle was first toggled on and
off.
This is why anyone trying this code under mach
should use extra caution. KMotion console is useful help in tracing the messages
and figuring out what happens.
If you ever get a moment that you have nothing
better to do ( ;-) ) you might take a look at this to see if there is something
that you can do in plug in to prevent this.
Rgds,
Tapio
----- Original Message -----
Sent: Sunday, June 07, 2015 10:13
PM
Subject: Re: [DynoMotion] Lathe
Setup
Hi Tapio,
Thanks for sharing we really appreciate
it.
But I see one issue. (It might have
been from one of our examples). A continuous Jog at some speed will
never indicate "Done". For a Jog the "Done" condition will only go true
when a Jog Speed of zero (stop) is commanded and then after completely
stopped.
So the:
while
(!CheckDone(SPINDLE_AXIS));
should probably be removed
from the
case
EX_SPINSPEED:
and
case
EX_SPINON:
It may work ok because the program
will simply never complete and be killed by the next Spindle command.
Regards
TK
| | | | | | | | | |